package com.itheima.sh.feign;

import com.itheima.sh.feign.fallback.UserFeignFallBackApi;
import com.itheima.sh.pojo.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Primary;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.Map;

/**
 * @author YYP
 * @date 2020/12/20
 */
//@FeignClient("user-service") //Rureka 获取到服务实例名称
@FeignClient(value = "user-service",fallback = UserFeignFallBackApi.class)
@Primary //容器中有两个相同的bean，使用这个优先
public interface UserFeignApi {
    //服务提供发提供接口的方法
    @GetMapping("/user/{id}")
    public User queryById(@PathVariable("id") String username);
}
